package com.xy.common.base;

import com.xy.entity.User;
import io.swagger.annotations.Api;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RestController;

@Api
@RestController
public class BaseController {
    public String userId;
    public String userName;
    public User user;

    public void initBaseInfo() {
        user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        userId = user.getUuid();
        userName = user.getUsername();
    }
}

